package com.bos.mapper;

import com.bos.data.model.BosCommentModel;
import com.bos.data.model.BosUserModel;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CommentMapper {
    //1.查询所有的评论内容
    @Select("select * from bos_comment where comid=#{id} order by id desc")
    public List<BosCommentModel> findComment(int id);

    //2.将评论内容插入到评论表中
    @Insert("insert into bos_comment(ccontext,ctime,cname,comid,image) values(#{ccontext},#{ctime},#{cname},#{comid},#{image})")
    public int insertComment(BosCommentModel comm);

    //3.应该查询用户表中跟关联id对应的用户信息（评论人）
    @Select("select * from bos_user where userid=#{comid}")
    public BosUserModel findUserByID(int id);
}
